//
//  HttpRequest.h
//  youyue
//
//  Created by oceans on 2018/8/15.
//

#import <Foundation/Foundation.h>
#import "GlobalPath.h"

typedef void(^HttpRequestSuccessfulBlock)(id _Nullable result);
typedef void(^HttpRequestFailedBlock)(int code, NSString *errMsg);

@interface MetaModel : NSObject

@property (assign, nonatomic) int totalCount;
@property (assign, nonatomic) int pageCount;
@property (assign, nonatomic) int currentPage;
@property (assign, nonatomic) int perPage;
- (instancetype)initWithDic:(NSDictionary *)dic;
@end

@interface HttpRequest : NSObject

+ (void)getURL:(NSString*)url paras:(NSDictionary*)paras showProgress:(BOOL)showProgress successful:(HttpRequestSuccessfulBlock)successful failed:(HttpRequestFailedBlock)failed;
+ (void)postURL:(NSString*)url paras:(NSDictionary*)paras showProgress:(BOOL)showProgress successful:(HttpRequestSuccessfulBlock)successful failed:(HttpRequestFailedBlock)failed;
+ (void)uploadImage:(NSString*)url paras:(NSDictionary*)paras image:(NSData *)image showProgress:(BOOL)showProgress successful:(HttpRequestSuccessfulBlock)successful failed:(HttpRequestFailedBlock)failed;
@end
